package com.test.util;

import java.util.HashMap;


import java.util.Map;

import common.BaseEntity;

/**
 * 通过ajax请求或api方式，返回json格式的结果
 * 
 * @author FLF
 */
public class JsonResult extends BaseEntity {
	private static final long serialVersionUID = -3525393844731870123L;
	private int code = JsonResultCode.SUCCESS; // 只有当其=1时，才是正确响应的数据
	private String msg; // 响应的提示信息
	private Object data;
	private String battleData;

	public static JsonResult newInstance() {
		return new JsonResult();
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		if (msg == null) {
			msg = JsonResultCode.getMsg(code);
		}
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getBattleData() {
		return battleData;
	}

	public void setBattleData(String battleData) {
		this.battleData = battleData;
	}
	
}
